Optimal. Leaf size=88 \[ \frac {A x}{a}+\frac {C \tanh ^{-1}(\sin (c+d x))}{b d}-\frac {2 \left (A b^2+a^2 C\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} b \sqrt {a+b} d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.11, antiderivative size = 88, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.240, Rules used = {4136, 3855,
4004, 3916, 2738, 214} \begin {gather*} -\frac {2 \left (a^2 C+A b^2\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a b d \sqrt {a-b} \sqrt {a+b}}+\frac {A x}{a}+\frac {C \tanh ^{-1}(\sin (c+d x))}{b d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 214
Rule 2738
Rule 3855
Rule 3916
Rule 4004
Rule 4136
Rubi steps
\begin {align*} \int \frac {A+C \sec ^2(c+d x)}{a+b \sec (c+d x)} \, dx &=\frac {\int \frac {A b-a C \sec (c+d x)}{a+b \sec (c+d x)} \, dx}{b}+\frac {C \int \sec (c+d x) \, dx}{b}\\ &=\frac {A x}{a}+\frac {C \tanh ^{-1}(\sin (c+d x))}{b d}-\left (\frac {A b}{a}+\frac {a C}{b}\right ) \int \frac {\sec (c+d x)}{a+b \sec (c+d x)} \, dx\\ &=\frac {A x}{a}+\frac {C \tanh ^{-1}(\sin (c+d x))}{b d}-\frac {\left (\frac {A b}{a}+\frac {a C}{b}\right ) \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{b}\\ &=\frac {A x}{a}+\frac {C \tanh ^{-1}(\sin (c+d x))}{b d}-\frac {\left (2 \left (\frac {A b}{a}+\frac {a C}{b}\right )\right ) \text {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b d}\\ &=\frac {A x}{a}+\frac {C \tanh ^{-1}(\sin (c+d x))}{b d}-\frac {2 \left (\frac {A b}{a}+\frac {a C}{b}\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} \sqrt {a+b} d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.45, size = 239, normalized size = 2.72 \begin {gather*} \frac {2 \left (C+A \cos ^2(c+d x)\right ) \left (\sqrt {a^2-b^2} \left (A b d x-a C \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+a C \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right ) \sqrt {(\cos (c)-i \sin (c))^2}+2 \left (A b^2+a^2 C\right ) \text {ArcTan}\left (\frac {(i \cos (c)+\sin (c)) \left (a \sin (c)+(-b+a \cos (c)) \tan \left (\frac {d x}{2}\right )\right )}{\sqrt {a^2-b^2} \sqrt {(\cos (c)-i \sin (c))^2}}\right ) (i \cos (c)+\sin (c))\right )}{a b \sqrt {a^2-b^2} d (A+2 C+A \cos (2 (c+d x))) \sqrt {(\cos (c)-i \sin (c))^2}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.21, size = 114, normalized size = 1.30
method | result | size |
derivativedivides | \(\frac {-\frac {2 \left (A \,b^{2}+a^{2} C \right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{b a \sqrt {\left (a +b \right ) \left (a -b \right )}}-\frac {C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{b}+\frac {C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{b}+\frac {2 A \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}}{d}\) | \(114\) |
default | \(\frac {-\frac {2 \left (A \,b^{2}+a^{2} C \right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{b a \sqrt {\left (a +b \right ) \left (a -b \right )}}-\frac {C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{b}+\frac {C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{b}+\frac {2 A \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}}{d}\) | \(114\) |
risch | \(\frac {A x}{a}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) A}{\sqrt {a^{2}-b^{2}}\, d a}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) C}{\sqrt {a^{2}-b^{2}}\, d b}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) A}{\sqrt {a^{2}-b^{2}}\, d a}-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) C}{\sqrt {a^{2}-b^{2}}\, d b}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{b d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{b d}\) | \(341\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 4.56, size = 362, normalized size = 4.11 \begin {gather*} \left [\frac {2 \, {\left (A a^{2} b - A b^{3}\right )} d x + {\left (C a^{2} + A b^{2}\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) + {\left (C a^{3} - C a b^{2}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (C a^{3} - C a b^{2}\right )} \log \left (-\sin \left (d x + c\right ) + 1\right )}{2 \, {\left (a^{3} b - a b^{3}\right )} d}, \frac {2 \, {\left (A a^{2} b - A b^{3}\right )} d x - 2 \, {\left (C a^{2} + A b^{2}\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) + {\left (C a^{3} - C a b^{2}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (C a^{3} - C a b^{2}\right )} \log \left (-\sin \left (d x + c\right ) + 1\right )}{2 \, {\left (a^{3} b - a b^{3}\right )} d}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {A + C \sec ^{2}{\left (c + d x \right )}}{a + b \sec {\left (c + d x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.49, size = 144, normalized size = 1.64 \begin {gather*} \frac {\frac {{\left (d x + c\right )} A}{a} + \frac {C \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{b} - \frac {C \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{b} - \frac {2 \, {\left (C a^{2} + A b^{2}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{\sqrt {-a^{2} + b^{2}} a b}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 9.81, size = 2500, normalized size = 28.41 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________